<template>
<el-row class="tac" style="height: 100%">
  <el-col class="first">
    <div class="block">
    <div class="avatar">
      <!-- 显示头像 -->
    </div>
    <div class="name">
      <div class="content">
        <span>{{name}}</span>
      </div>
      <div class="content">
        <span>{{position}}</span>
      </div>
    </div>
    </div>

  </el-col>
  <el-col :span="12" style="height: 100%">
    <el-menu
      router
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      background-color="#ABC270"
      text-color="#fff"
      active-text-color="#fff"
      style="height: 100%"
      >
      <el-menu-item class="today" index="/today">
        <span slot="title">Today</span>
      </el-menu-item>
      <el-menu-item class="roster" index="/roster">
        <span slot="title">Roster</span>
      </el-menu-item>
      <el-menu-item class="data" index="/data">
        <span slot="title">Data</span>
      </el-menu-item>
      <el-menu-item class="department" index="/department">
        <span slot="title">Department</span>
      </el-menu-item>
      <el-menu-item class="affairs" index="/affairs">
        <span slot="title">Affairs</span>
      </el-menu-item>
      <div id="circle1"></div>
      <div id="circle2"></div>
      <div class="other">
        <el-button type="text" @click="logoutClick">LOG OUT</el-button>
        <el-button type="text" @click="goTo('/setting')">SETTING</el-button>
      </div>
    </el-menu>
  </el-col>
</el-row>
</template>

<script>
export default {
  name: 'VerticalMenu',
  data() {
    return {
      name: 'Jackson',
      position: 'manage',
      user: {
        name: 'Jackson',
        position: 'manage',
      },
    }
  },
  created(){
    this.user = JSON.parse(sessionStorage.getItem('user'));
    this.name = this.user.name;
    this.position = this.user.position;
  },
  methods: {
    goTo(path) {
      this.$router.replace(path);
    },
    logoutClick(){
      sessionStorage.clear();
      this.$router.push('/index')
    }
  }
}
</script>

<style  lang="less" scoped>
  .tac{
    width: 250px;
    position: fixed;
  }

  .first{
    background-color: #96A961;
    width: 250px;
    height: 100px;
    /* line-height: 85px; */
    color: #ffffff;
  }

  .avatar{
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-top: 25px;
    margin-left: 34px;
  }

  .name {
    position: relative;
    display: inline-block;
    height: 50px;
    width: 120px;
    top: -5px;
    left: 20px;
  }

  .content {
    line-height: 20px;
    font-size: 13px;
    width: 100px;
    height: 20px;
    color: #333333;
    border-radius: 5px;
    text-align:center;
    background-color: #F2F2F2;
    margin-bottom: 10px;
  }

  .el-col-12 {
    width: 251px;
  }

  .el-menu-item {
    text-align: center;
    margin-top: 10px;
    font-size: 18px;
  }

  .el-menu-item:hover{
    background: #96A961 !important;
  }

  .el-menu-item.is-active{
    background: #96A961 !important;
  }

  .other {
    position: fixed;
    display: inline-block;
    bottom: 0px;
  }

  .el-button {
    color: #333333;
    font-weight: 600;
    margin-left: 40px;
  }

  #circle1 {
    border-width: 1px;
    position: absolute;
    left: -117px;
    top: 500px;
    width: 324px;
    height: 324px;
    display: flex;
    border-radius:50%;
    background-color: rgba(150, 167, 97, 0.8);
  }

  #circle2 {
    border-width: 1px;
    border-color: rgba(253, 167, 105, 0.5);
    position: absolute;
    left: -98px;
    top: 431px;
    width: 180px;
    height: 180px;
    display: flex;
    border-radius:50%;
    background-color: rgba(253, 167, 105, 0.7);
  }
</style>
